package com.tisson.action;

import java.util.List;

import com.tisson.CheckService;
import com.tisson.bo.LoginBO;

public class LoginAction extends ActionSup {
	private String username;
	private String password;
	private CheckService checkService = new CheckService();

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String login() {
		LoginBO bo = new LoginBO();
		bo.saveUserInfo(request, username, password);
		if (checkService.isExist(username, password)) {
			request.getSession().setAttribute("username", username);
			request.getSession().setAttribute("password", password);
			request.getSession().setAttribute("menu", bo.getMenu(request));
			return "success";
		} else {
			return "failure";
		}
	}

}
